<?php

class Application_Form_Authorization extends Zend_Form {

    public function init() {
        $this->setName('validate');
        $this->setAttrib('class', 'form');

        $login = new Zend_Form_Element_Text('login');
        $login->setLabel('Login')
                ->setRequired(true)
                ->addValidator('NotEmpty')
                ->addFilter('StripTags')
                ->addFilter('StringTrim')
                ->setAttrib('id', 'login')
                ->setAttrib('class', 'validate[required]');
        

        $login->setDecorators(array(
            'ViewHelper',
            //'Description',
            'Errors',
            array('HtmlTag', array('tag' => 'div', "class" => "loginInput")),
            array('Label'),
            array(array('endbit' => 'HtmlTag'), array('tag' => 'div', 'class' => 'clear', 'placement' => 'append')),
            array(array('row' => 'HtmlTag'), array('tag' => 'div', "class" => 'formRow'))
        ));




        $password = new Zend_Form_Element_Password('password');
        $password->setLabel('Password')
                ->setRequired(true)
                ->addValidator('NotEmpty')
                ->addFilter('StripTags')
                ->addFilter('StringTrim')
                ->setAttrib('id', 'pass')
                ->setAttrib('class', 'validate[required]');

        $password->setDecorators(array(
            'ViewHelper',
            //'Description',
            'Errors',
            array('HtmlTag', array('tag' => 'div', "class" => "loginInput")),
            array('Label'),
            array(array('endbit' => 'HtmlTag'), array('tag' => 'div', 'class' => 'clear', 'placement' => 'append')),
            array(array('row' => 'HtmlTag'), array('tag' => 'div', "class" => 'formRow'))
        ));
        $remember = new Zend_Form_Element_Checkbox('remember');
        $remember->setLabel('Remember me')
                ->setAttrib('id', 'remMe')
                ->setDecorators(array(
                    'ViewHelper',
                    //'Description',
                    'Errors',
                    array('Label'),
                    array('HtmlTag', array('tag' => 'div', "class" => "rememberMe")),
                    array(array('row' => 'HtmlTag'), array('tag' => 'div', "class" => 'loginControl', 'placement' => 'prepend', 'openOnly' => true))
                ));

        $submit = new Zend_Form_Element_Submit('submit');
        $submit->setLabel('Authorization')
                ->setAttrib('class', 'dredB logMeIn')
                ->setDecorators(array(
                    'ViewHelper',
                    //'Description',
                    'Errors',
                    array(array('endbit' => 'HtmlTag'), array('tag' => 'div', 'class' => 'clear', 'placement' => 'append'))));

        $this->setElements(array($login, $password, $remember, $submit));
    }

}

